Incident Report Pagination issue

I am trying to print the Total INC count for each day of previous month. Issue i am getting is its limit only upto 100 per day. How to get the right count ?

import requests
import requests
import json
import datetime

def get_incident_count():

api_key = 'XXXXXXXXXXX'
until = date.today().replace(day=1) - timedelta(days=1)
since = date.today().replace(day=1) - timedelta(days=until.day)
First_day=str(since)
next_day = since + timedelta(days=1)
last_day=str(until)

#print(until,type(until),since,type(since))
#print(last_day,type(last_day),First_day,type(First_day))
Count=0

headers = {'Accept': 'application/vnd.pagerduty+json;version=2',
           'Authorization': 'Token token={token}'.format(token=api_key),
           'Content-type': 'application/json'}
while since <= until:
    #print(since,until)
    response = requests.get('https://api.pagerduty.com/incidents?team_ids[]=XXXXX',headers=headers,params={'since': since,'until':next_day,'limit': 200,"next_cursor": "UExIMUhLVg=="})
    Total=0
    #print(response.json())#['incidents'])
    #page = response.json()[‘more’]
    for i in response.json()['incidents']:

        Total = Total +1
        #print(Total)

    Count += Total
    print(since,Total)
    since = since + timedelta(days=1)
    next_day = next_day + timedelta(days=1)




print(Count)

get_incident_count()

Hi!

Thanks for reaching out!

You’ll need to use pagination as described in our Developer documentation here.

Please let me know if this is helpful or you have additional questions.

Regards,

Alex Engelmann
Technical Support Specialist
PagerDuty.com